package cn.wangzg.course0402;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

public class OtherActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_other);

        TextView textView=findViewById(R.id.textView);
        //Ctrl+Alt+v
        String one = getIntent().getStringExtra("one");
        //获取对象
        //User user= (User) getIntent().getSerializableExtra("user");
        User user=MyApp.getInstance().getUser();
        //Person person=getIntent().getParcelableExtra("person");
        Person person=MyApp.getInstance().getPerson();
        textView.setText(one+"\n"+user.getName()+"   "+user.getGender()+"\n"+person.getName());

    }

    public void btnReturn(View view){
        EditText editText=findViewById(R.id.editText2);
        String str=editText.getText().toString();
        Intent intent =new Intent();
        intent.putExtra("ret",str);
        setResult(20,intent);
        finish();
    }


}
